<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh">
<head>
    <base href="/KJtest/">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>SSM整合考试</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <script src="js/jquery.min.js"></script>
    <meta name="author" content="yinqi">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/materialdesignicons.min.css" rel="stylesheet">
    <link href="css/style.min.css" rel="stylesheet">
    <script>
        function goback() {
            location.href = "page/list"
        }

        function add() {
            var serialize = $("#form1").serialize();
           /* console.log(serialize);*/
            $.getJSON("user/insert",serialize,function (data) {
                /*console.log(data);*/
                if (data.code == 200){
                    alert(data.msg)
                    $("#form1")[0].reset()
                }else {
                    alert(data.msg)
                }
            })
        }
    </script>
</head>
<body>
<div class="row">
    <div class="col-md-12">
        <ol class="breadcrumb">
            <li><a href="#">系统管理</a></li>
            <li><a href="#">用户管理</a></li>
            <li><a href="#">更新用户</a></li>
        </ol>
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        <div class="card">
            <div class="card-body">
                <form class="form-horizontal" id="form1" >
                    <div class="form-group" >
                        <label class="col-md-1 control-label" for="username">用户名</label>
                        <div class="col-md-4">
                            <input class="form-control" type="text" id="username" name="username" placeholder="请输入用户名">
                        </div>
                        <br><br><br>
                        <label class="col-md-1 control-label" for="truename">姓名</label>
                        <div class="col-md-4">
                            <input class="form-control" type="text" id="truename" name="truename" placeholder="请输入姓名">
                        </div>
                        <br><br><br>
                        <label class="col-md-1 control-label" for="truename">密码</label>
                        <div class="col-md-4">
                            <input class="form-control" type="password" id="password" name="password" placeholder="请输入密码">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-9 col-md-offset-3">
                            <button class="btn btn-primary" type="button" style="width:200px;" onclick="add()">添加</button>
                            <button class="btn btn-primary" type="button" style="width:200px;" onclick="goback()">返回</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
</body>
</html>
